package com.hdax.dm.rest;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hdax.dm.api.scheduler.SeatControllerAPI;
import com.hdax.dm.entity.scheduler.DmSchedulerSeat;
import com.hdax.dm.service.SchedulerSeatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class RestSeatService implements SeatControllerAPI {

    @Autowired
    private SchedulerSeatService seatService;

    @Override
    public DmSchedulerSeat seatDetail(Long scheduleId, Long x, Long y) {
        QueryWrapper<DmSchedulerSeat> queryWrapper = new QueryWrapper<DmSchedulerSeat>()
                .eq("scheduleId",scheduleId)
                .eq("x",x)
                .eq("y",y)
                .isNull("orderNo")
                .isNull("userId")
                .eq("status",1L);
        return seatService.getOne(queryWrapper);
    }

    @Override
    public boolean changeSeatByOrder(List<DmSchedulerSeat> params) {
        return seatService.changeSeatByOrder(params);
    }
}
